import os

xml_folder = 'F:\学习\数据集\实验室数据集操作版\性诱\性诱网站下载221026\标注'  # 替换为实际的xml文件夹路径
jpg_folder = 'F:\学习\数据集\实验室数据集操作版\性诱\性诱网站下载221026\图片'  # 替换为实际的jpg文件夹路径

xml_files = set([os.path.splitext(file)[0] for file in os.listdir(xml_folder) if file.endswith('.xml')])
jpg_files = set([os.path.splitext(file)[0] for file in os.listdir(jpg_folder) if file.endswith('.jpg')])

files_to_delete = xml_files - jpg_files

for file_name in files_to_delete:
    file_path = os.path.join(xml_folder, file_name + '.xml')
    os.remove(file_path)